using System;
using System.Collections.Generic;
using System.Text;

using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

namespace ScytheEngine
{
	public class SceneGraphNode
	{
		#region Data Members

		protected SceneGraphNodesCollection m_Nodes;

		#endregion

		#region Ctors

		public SceneGraphNode()
		{
			m_Nodes = new SceneGraphNodesCollection();
		}

		#endregion

		#region Methods

		public void AddNode(SceneGraphNode node)
		{
			m_Nodes.Add( node );
		}

		public virtual void Update()
		{
			foreach (SceneGraphNode node in m_Nodes)
			{
				node.Update();
			}
		}

		public virtual void Draw(GraphicsDevice gfxDev)
		{
			foreach(SceneGraphNode node in m_Nodes)
			{
				node.Draw( gfxDev );
			}
		}

        public virtual void LoadContent(GraphicsDevice gfxDev, ContentManager loader)
        {
            foreach(SceneGraphNode node in m_Nodes)
            {
                node.LoadContent(gfxDev, loader);
            }
        }

        public virtual void ClearChildrenNodes()
        {
            // clear any children
            foreach(SceneGraphNode childNode in m_Nodes)
            {
                childNode.ClearChildrenNodes();
            }
            // clear this node
            m_Nodes.Clear();
        }

		#endregion
	}
}
